package com.cainaer.orders.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cainaer.orders.domain.Orders;
import com.cainaer.orders.mapper.OrdersMapper;
import com.cainaer.orders.service.IOrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 订单表 服务实现类
 * </p>
 *
 * @author Tina
 * @since 2020-09-11
 */
@Service
public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, Orders> implements IOrdersService {

    @Autowired
    private OrdersMapper ordersMapper;

    /**
     * 新增订单
     *
     * @param orders
     * @return
     */
    @Override
    public Integer insertOrders(Orders orders) {
        return ordersMapper.insert(orders);
    }

    /**
     * 编辑订单
     *
     * @param orders
     * @return
     */
    @Override
    public Integer editOrders(Orders orders) {
        return ordersMapper.updateById(orders);
    }

    /**
     * 查询订单
     *
     * @param orders
     * @return
     */
    @Override
    public List<Orders> queryOrders(Orders orders) {
        return ordersMapper.queryOrders(orders);
    }

    /**
     *查询市场月销量
     *
     @param shopId
      @return
     */
    @Override
    public Integer querySalesVolumeByShopId(Long shopId){

       return ordersMapper.querySalesVolumeByShopId(shopId);
    };

}
